Skip to contentSkip to conversation

Change in openvpn[master]: socket: use remote proto when creating client sockets

Openvpn-devel In review ordex (Code Review) 2 participants 7 messages Mar 20, 2025 – Apr 1, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1742429994000.I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/911?usp=email

to review the following change.

Change subject: socket: use remote proto when creating client sockets
......................................................................

socket: use remote proto when creating client sockets

When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote.

The listening protocol in this case is just ignored as it does not make any sense.

Change-Id I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9

---
M src/openvpn/socket.c

1 file changed, 5 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/11/911/1

src/openvpn/socket.c +5 -0
index 6b32e30..ad97830 100644
@@ -1886,6 +1886,11 @@
     const char *remote_host = o->ce.remote;
     const char *remote_port = o->ce.remote_port;
 
+    if (remote_host)
+    {
+        proto = o->ce.proto;
+    }
+
     if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP)
     {
         struct link_socket *tmp_sock = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9
Gerrit-Change-Number: 911
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/911?usp=email )

Change subject: socket: use remote proto when creating client sockets
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9
Gerrit-Change-Number: 911
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Mar 2025 08:54:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/911?usp=email )

Change subject: socket: use remote proto when creating client sockets
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
This fixes the bug I am seeing and looks good.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9
Gerrit-Change-Number: 911
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Mar 2025 08:55:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw

PATCH 1/1 socket: use remote proto when creating client sockets

In reply to a message not in the archive

From: Antonio Quartulli <[email protected]...>

When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote.

The listening protocol in this case is just ignored as it does not make any sense.

Change-Id I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/911
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/socket.c +5 -0
index 6b32e30..ad97830 100644
@@ -1886,6 +1886,11 @@
     const char *remote_host = o->ce.remote;
     const char *remote_port = o->ce.remote_port;
 
+    if (remote_host)
+    {
+        proto = o->ce.proto;
+    }
+
     if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP)
     {
         struct link_socket *tmp_sock = NULL;
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: socket: use remote proto when creating client sockets

Yeah, too many protos around... Arne and Lev confirm that this is what is needed to un-confuse "--local <with proto>" and "--remote <with proto>" and general "--<proto>" (--udp4 etc) for the client case...

Tested with standard and extended t_client test set (extended = one stanza that has multiple --remote with different protos *and* --local bound to a local IP).

There's a number of interesting ways to break things here ("--local ipv4 --remote ipv6 --proto udp6") but that's all clear misconfigs - these have never worked, it's just that the error messages
are bit different with multisocket. "--local $hostname" with something
that resolves to both an ipv4 and ipv6 address nicely binds to whatever the "--remote" stanza tries to use (v4/v6). Good.

Your patch has been applied to the master branch.

commit 39cd7f29cbccd37b07ddc27eb23b8ad270f43e77

Author: Antonio Quartulli
Date:   Tue Mar 25 11:57:24 2025 +0100
     socket: use remote proto when creating client sockets

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31234.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by ordex. ( http://gerrit.openvpn.net/c/openvpn/+/911?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: socket: use remote proto when creating client sockets
......................................................................

socket: use remote proto when creating client sockets

When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote.

The listening protocol in this case is just ignored as it does not make any sense.

Change-Id I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31234.html

---
M src/openvpn/socket.c

1 file changed, 5 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/11/911/2

src/openvpn/socket.c +5 -0
index 09de1b0..4fb6fe6 100644
@@ -1903,6 +1903,11 @@
     const char *remote_host = o->ce.remote;
     const char *remote_port = o->ce.remote_port;
 
+    if (remote_host)
+    {
+        proto = o->ce.proto;
+    }
+
     if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP)
     {
         struct link_socket *tmp_sock = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9
Gerrit-Change-Number: 911
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/911?usp=email )

Change subject: socket: use remote proto when creating client sockets
......................................................................

socket: use remote proto when creating client sockets

When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote.

The listening protocol in this case is just ignored as it does not make any sense.

Change-Id I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31234.html

---
M src/openvpn/socket.c

1 file changed, 5 insertions(+), 0 deletions(-)
src/openvpn/socket.c +5 -0
index 09de1b0..4fb6fe6 100644
@@ -1903,6 +1903,11 @@
     const char *remote_host = o->ce.remote;
     const char *remote_port = o->ce.remote_port;
 
+    if (remote_host)
+    {
+        proto = o->ce.proto;
+    }
+
     if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP)
     {
         struct link_socket *tmp_sock = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9
Gerrit-Change-Number: 911
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged